<template>
	<view>
		<view class="head">
			<view class="head_left" @tap="back()">
				<image src="../../../static/wode/return.png" mode=""></image>
			</view>
			<view class="head_mid">
				课程总结
			</view>
			<view class="head_left">

			</view>
		</view>
		<view class="padding-box">
			<view class="head_box" v-if="type!=''">
				<view class="box_left">
					<image :src="masterinfo.avatar" mode=""></image>
					<text>{{masterinfo.nick_name}}</text>
				</view>
				<view class="box_right">
					《{{summaryData.title}}》
				</view>
			</view>
			<view class="body_box">
				<view class="box_title">
					内容点
				</view>
				<view class="box_item" v-if="type!=''">
					{{summaryData.content}}
				</view>
				<textarea class="text_box" v-model="content" auto-height="true" v-else />
				</view>
			<view class="body_box">
				<view class="box_title" >
					关键单词
				</view>
				<view class="box_item" v-if="type!=''">
					{{summaryData.word}}
				</view>
				<textarea class="text_box" v-model="word"  auto-height="true" v-else />

			</view>
			<view class="body_box">
				<view class="box_title">
					语法
				</view>
				<view class="box_item" v-if="type!=''">
					{{summaryData.grammar}}
				</view>
				<textarea class="text_box" v-model="grammar"  auto-height="true" v-else />

			</view>
			<view class="body_box">
				<view class="box_title">
					建议
				</view>
				<view class="text2" v-if="type!=''">
					{{summaryData.proposal}}
				</view>
				<textarea class="text_box text_box2" v-model="proposal"  auto-height="true" v-else />
			</view>
			<view class="btn" v-if="type==''" @tap="setSummary">
				确认
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:'',
				id:'',//课程总结id
				summaryData:'',//总结数据
				masterinfo:'',//助学师数据
				content:'',//内容
				word:'',//单词
				grammar:'',//语法
				proposal:'',//建议
			}
		},
		onLoad(option) {
			if(option.type!=undefined){
				this.type=option.type//查看课程总结
				this.id=option.id
				this.getList()
			}
		},
		methods: {
			back() { //返回
				uni.navigateBack({
					delta: 1
				})
			},
			getList(){
				var me=this;
				var data={
					id:this.id,
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'userAppointment',
					actionName: 'querySummaryListPage',
					data: data,
					successBack: function(res) {
						console.log(res,'课程总结详情')
						me.summaryData=res.data.data[0]
						me.masterinfo=res.data.data[0].map.masterinfo
					}
				})
			},
			setSummary(){//提交总结
				var me=this;
				var data={
					appointment_id:this.summaryData.id,//课程id
					master_id:this.masterinfo.user_id,
					content:this.content,
					grammar:this.grammar,
					word:this.word,
					proposal:proposal
				}
				this.myAjaxNewPost({
					model: 'user',
					controllerName: 'userAppointment',
					actionName: 'insert',
					data: data,
					successBack: function(res) {
						console.log(res)
					}
				})
			},
		}
	}
</script>

<style scoped>
.head {
		width: 100%;
		display: flex;
		justify-content: space-between;
		height: 162upx;
		background: #ffffff;
		padding: 0 24upx;
		z-index: 200;
		position: fixed;
		top: 0;
		box-sizing: border-box;
	}

	.head image {
		width: 20upx;
		height: 36upx;
		margin-right: 9upx;
	}

	.head_left {
		height: 82upx;
		width: 106upx;
		display: flex;
		align-items: center;
		line-height: 82upx;
		color: #666666;
		padding-top: 70upx;
		font-size: 32upx;
	}
	.head_mid{
		padding-top: 90upx;
	}

	.head_right {
		width: 120upx;
	}
	.padding-box{
		padding-top: 182upx;
	}
	.head_box{
		background: #FFFFFF;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 146upx;
		padding: 0 24upx;
	}
	.box_left{
		display: flex;
		align-items: center;
		color: #333333;
		font-size: 32upx;
	}
	.box_left image{
		width: 106upx;
		height: 106upx;
		margin-right: 20upx;
		border-radius: 50%;
		overflow: hidden;
	}
	.box_right{
		color: #666666;
		font-size: 26upx;
	}
	.body_box{
		background: #FFFFFF;
		padding: 0 24upx;
		margin-top: 20upx;
	}
	.box_title{
		color: #333333;
		font-size: 32upx;
		height: 88upx;
		line-height: 88upx;
		border-bottom: 1upx solid #E6E6E6;
		font-weight:bold;
	}
	.box_item{
		color: #46CECF;
		font-size: 26upx;
		height: 80upx;
		line-height: 80upx;
	}
	.text2{
		color: #333333;
		font-size: 28upx;
		padding: 15upx 0 60upx 0;
	}
	.text_box{
		/* line-height: 70upx; */
		width: 100%;
		padding: 24upx 0;
		color: #46CECF;
		font-size:26upx ;
	}
	.text_box2{
		color: #333333;
		font-size: 28upx;
	}
	.btn{
		position: absolute;
		border-radius: 44upx;
		left: 24upx;
		bottom: 60upx;
	}
</style>
